﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Globalization;

namespace IridiumDB.Model
{
    public class Location
    {
        public Guid ID { get; set; }
        public String LocationName { get; set; }
        public String LocationUrl
        {
            get
            {
                String locationName = Regex.Replace(LocationName, @"\s", "+");
                String timezoneName = TimezoneName ?? "CET";
                var pieces = new Object[] { PreviewDuration, GpsLat.ToString(CultureInfo.InvariantCulture), GpsLong.ToString(CultureInfo.InvariantCulture), locationName, Altitude, timezoneName };
                return String.Format("http://www.heavens-above.com/iridium.asp?Dur={0}&lat={1}&lng={2}&loc={3}&alt={4}&tz={5}",pieces);
            }
        }
        public float GpsLat { get; set; }
        public float GpsLong { get; set; }
        public int Altitude { get; set; }
        public int PreviewDuration { get; set; }
        public String TimezoneName { get; set; }
    }
}
